package a.assembly {

import a.info.*;

public class BlankPaperWrapper {
    public function BlankPaperWrapper() {
    }

    public var wbinfo:* = new Object();//WhiteBoardInfo();
    private var shapeMgr:* = new Object();//ShapeManager();//管理着当前显示的图像

    public function removeAll():void {
        // remove all shapes
        shapeMgr.removeAll();
    }

    public function removeShape(shapeID:String):void {
        //removeChild(shapeMgr.getShape(shapeID))
        shapeMgr.removeShape(shapeID);
    }

    public function populate(awbinfo:WhiteBoardInfo):void {
        wbinfo = awbinfo;

        showCurrentPage();
    }
    public function populateAction(shapeInfoAction:ShapeInfoAction):void {
        if(shapeInfoAction.type == ShapeInfoAction.CREATE) {
            var shapeInfo:ShapeInfo = shapeInfoAction.shapeInfo;

            // create shape assembly
            shapeMgr.createShape(shapeInfo.shapeType)
            // set shapeInfo
        }
        else if(shapeInfoAction.type == ShapeInfoAction.MODIFY) {
            // get shape assembly
            shapeMgr.getShape(shapeInfo.shapeID);
            // set shapeInfo
        }
        else if(shapeInfoAction.type == ShapeInfoAction.REMOVE) {
            removeShape(shapeInfo.shapeID);
        }
    }

    // 创建新图形
    public function createShape(shapeID:String):void {
    	// add new shape to shapemanager
    	//shapeMgr.addShape();
    	
    	// add create shape action to  wbinfo    	
    	//wbinfo.getCurrPage().addShapeInfoAction();
    	
    	// notify create shape action
    }

	//显示当前页
    public function showCurrentPage():void {
        removeAll();

        var wbPage:WhiteBoardPageInfo = wbinfo.getCurrPage();
        var shapeInfoActions:Array = wbPage.getShapeInfoActions();

        // populate new shape
        for(var i:int = 0; i < shapeInfoActions.length; i++) {
            populateAction(shapeInfoActions[i]);
        }
    }

	/**
    // 创建新页面
    public function createPage(idx:Number = NaN):void {
        wbinfo.createPage(idx);

        showCurrentPage();
    }

    // 删除页
    public function removePage(idx:Number = NaN):void {
        wbinfo.removePage(idx);

        showCurrentPage();
    }

    //翻页
    public function gotoPage(idx:Number = NaN):void {
        wbinfo.currPage = idx;

        showCurrentPage();
    }

	// 清空页
    public function clearPage(idx:Number = NaN):void {
        wbinfo.clearPage(idx);

        gotoPage(idx);
    }

	 // 显示页，goto page
     public function showPage(idx:Number):void {
        wbinfo.currPage = idx;
        showCurrentPage();
    }

 
 
     ***/
}
}